package com.zhmsky.mybatisplus_01.pojo;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * @author zhmsky
 * @date 2021/11/30 0:12
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {

    @TableId(type = IdType.AUTO)  //对应数据库中的主键(自增id)
    private Long id;

    private String username;
    private String password;

    @TableField(fill = FieldFill.INSERT)   //数据插入时自动更新时间
    private Date createTime;
    @TableField(fill = FieldFill.UPDATE)   //数据更新时自动填充时间
    private Date updateTime;


    public User(String username,String password){
        this.username=username;
        this.password=password;
    }
    public User(Long id,String username,String password){
        this.id=id;
        this.username=username;
        this.password=password;
    }
}
